package mall.kotlin.com.myapplication.material_design;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;

import mall.kotlin.com.myapplication.R;

public class MaterialDesignActivity extends AppCompatActivity {
    LinearLayout main;
    Button mButton;
    Button mButton2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_material_design);
        main = this.findViewById(R.id.main);
        mButton = findViewById(R.id.button);
        mButton2 = findViewById(R.id.loginBtn);
        mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show();
            }
        });
        mButton2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MaterialDesignActivity.this, BehaviorActivity.class);
                startActivity(intent);
            }
        });

    }

    private void show() {
        Snackbar.make(main, "你好", Snackbar.LENGTH_LONG)
                .setAction("点击", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Toast.makeText(MaterialDesignActivity.this, "00000000", Toast.LENGTH_SHORT).show();
                    }
                }).setDuration(Snackbar.LENGTH_LONG).show();
    }
}
